import random

award = 1000
lis = [1]


for i in lis:
    lis.append(i)
    list = random.sample(range(1, 6), 3)
    #print("随机生成的数是：", list)
    sum = list[0] + list[1] + list[2]
    #print(sum)

    sum1 = input("请输入大或者小， 若要退出，则输入Exit:")
    if sum1 == "Exit":
        break
    elif sum1 == "小":
        flag = 0
    elif sum1 == "大":
        flag = 1

    if 3 <= sum <= 10:
        flag1 = 0
    elif 11 <= sum <= 18:
        flag1 = 1

    if flag == flag1:
        award = award + 100
        print("您猜对了")
        win = 0
        win = win + 1
    else:
        award = award -100
        print("不好意思，您猜错了")
        lose = 0
        lose = lose + 1

    if award == 0:
        print("您的金豆不足,已自动退出游戏")
        break
    print(f"您剩余的金豆为:{award}")
print(win/(win+lose))

